home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
071 - EXFER 4.1 4.2.dsk
/
EXFER4.0
/
ÅØÆÅÒ®ÓÅÇ®Ó
next >
Wrap
Text File
|
2019-02-17
|
26KB
|
1,008 lines
; ****************************
;
; EXfer:
; The Extended Transfer Module
;
; This program is for use on
; the ProDOS version of GBBS
; "Pro" 1.2 or "Pro" 1.3.
;
; Written by: Mike Golaszewski
; (C)1986, All Rights Reserved
;
; Ymodem drivers courtesy of
; Greg Schaefer
;
; ****************************
; THIS IS NOT FREEWARE
; user segment, version 4.0
; created 08/22/86 - modified 05/26/87
; Special thanks to Mark Roberts for providing much of the ideas and concepts
; found in EXfer, and for vigorously testing the program; Jerry Cline for his
; ideas and suggestions; Kieth Christian for his support; Lance Taylor-Warren
; for providing GBBS 1.3 information; and especially Greg Schaefer ("Gee Ess")
; for providing the Ymodem drivers.
; define linkable labels
public prompt
public send.2
public terminate
; store existing variables
enter
on nocar goto terminate
print \"XT: Please hold..."
store "a1:variables":gosub store:clear
gosub recall:screen$=chr$(12)
v=0:f$="a1:sys.questions":gosub chkfil
close:if not(a) then v=13
b$=right$(lc$,3)+left$(lc$,5):lc$=b$
when$=ram2+14:ed=-25088:if not(v) goto begin
byte=ram+37:dl=byte(3)+nibble(3)*256
ul=byte(4)+nibble(4)*256:byte=ram2
; check for bit map file
begin
f$="a1:xt.bitmap":gosub chkfil:close
if (not(a)) goto begin.1:else fill ed+1,255,255
create f$:open #1,f$:write #1,ed+1,255:close
f$="a1:xt.volumes":kill f$:create f$
; get XMODEM type
begin.1
print \\screen$" :::::::::::::::::::::::::::::::::::::"
print ": EXfer: The Extended Transfer Module :"
print ': Version 4.0 :'
print " :::::::::::::::::::::::::::::::::::::"
if not(info(2)) input @2 \"Press [RETURN]..." i$:xm=3:goto start
input @2 '
XT: Are you using ProTERM or another
package that supports Ymodem ? ' i$:i$=left$(i$,1)
if i$="Y" then pt=1:xm=1:goto start
print '
XT: Please enter the type of XMODEM you
are using...
[1] DOS 3.3 Xmodem (AE "Pro" DOS)
[2] ProDOS Xmodem (Point to Point, AE)
[3] A standard from of Xmodem
[4] No Xmodem drivers, ASCII only'\
input @2 "XT: Which ? " i$:if i$="" goto exit.1
a=val(i$):if (a<1) or (a>4) goto begin
if a=1 then xm=2:else if a=2 then xm=1
if a=3 then xm=0:else if a=4 then xm=3
; try to access default library
start
bb=c:gosub log:if bf$="" goto start.2
if not(b2) gosub lsec:goto exit.1
; got it, enter EXfer
start.1
gosub getslt:gosub directory:goto prompt
; library does not exist
start.2
if not(info(5)) print \"XT: Can't find default library...":goto exit.1
tone(30,30):print \"XT: Source library does not exist..."
input @2 " Create ? " i$:if i$<>"Y" goto exit.1:else goto create
; get a command
prompt
on nocar goto terminate
x=(clock(2)-clock(1))/60:x$=right$("0"+str$(x),2)
if x=0 then x$="--":else if info(5) then x$="::"
print \"["x$"] ->";:if zz=1 then zz=0:goto command
free:clear key:get i$:print chr$(8)" "chr$(8);:push prompt
; check for normal command
command
if (i$="B") and (pt=1) goto batch
if i$="C" goto copy
if i$="D" goto directory
if i$="F" goto search
if i$="H" goto help
if i$="I" goto info
if (i$="J") or (i$="L") goto volume
if i$="K" goto kill
if i$="M" goto message
if i$="N" goto new
if i$="R" goto receive
if i$="S" goto send
if i$="T" goto hangup
if i$="V" goto view
if i$="?" goto menu
if (i$="X") or (i$="Q") goto exit
; check for librarian command
if not(lb) goto prompt.1
if i$="A" and (info(5)) pop:link "a:exfer.sys","add"
if i$="E" and (info(5)) pop:link "a:exfer.sys","external"
if i$="O" pop:link "a:exfer.sys","sort"
if i$="P" pop:ob=bb:goto create
if (i$="*") and (info(5)) input @2 "ProDOS: " i$:if i$ use "a:xdos",i$
; not a command
prompt.1
print " "chr$(8);:return
; display a menu
; ~~~~~~~~~~~~~~
menu
print \\screen$:f$="a1:mnu.exfer"
if lb f$="a1:sys.exfer"
open #1,f$:input #1,x$
setint(" "):for l=1 to len(x$):addint(mid$(x$,l,1))
next:print \s$\:copy #1
if key(1) then a=key(0):goto menu.cancel
if key(3) goto menu.key
menu.cancel
close:setint(""):goto prompt
menu.key
close:setint(""):i$=chr$(key(0))
zz=1:print:goto prompt
; display help on a command
; ~~~~~~~~~~~~~~~~~~~~~~~~~
help
input @2 "Help on which command: " i$:if i$="" return
x$="CDFHIKLMNRSTVX?B":x=instr(i$,x$):if x=0 return
ready "a1:hlp.exfer":print \s$\:input #msg(x),a,x$
input #6,x$:setint(1):print x$\:copy #6:setint("")
ready d2$:return
; message to librarian
; ~~~~~~~~~~~~~~~~~~~~
message
print \\screen$"Enter feedback: ["edit(3)"] cols, [4K] Max"
print "[DONE] when finished, [.H] for help":edit(0)
edit(1):if not(edit(2)) then return:else ready "a:mail"
x=b1:if not(x) then x=1
if info(6)<29 print \"XT: Bit-map full":ready d2$:return
print #msg(x),un:print #6,"EXfer: Feedback from a user"\
print #6,"From ->"a1$" "a2$" [#"un"]"
print #6,"Date ->"date$" "time$\:copy #8,#6
print #msg(x),chr$(4);chr$(0);
msg(x)=1:update:ready d2$:return
; send a file
; ~~~~~~~~~~~
; get name & verify it
send
if not(b3) goto lsec
input @2 "Send: " i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto send.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
send.x
if (l<0) goto nfile
if not(byte(7)) print '
XT: This file must first be validated
by the sysop before it can be
accessed...':return
na$=f$:gosub name:f$=bf$+f$:gosub chkfil
if a close:goto nfile
; compute time of transfer
close:bs=(byte(8)+byte(9)*256)*4
c=info(2):if xm=3 goto send.1
if c=1 then b=bs*4:b=b+(bs/30)
if c=4 then b=bs:b=b+((bs/30)*6)
if c=8 then b=bs/2:b=b+((bs/30)*12)
a=b/60:c=b mod 60:x=(clock(2)-clock(1))/60
print \"XT: Estimated time of transfer is"
print " "a" minutes, "right$("0"+str$(c),2)" seconds"
if clock(2)=0 goto send.1
if x<a print '
XT: 'chr$(7)'You do not have enough time left to
download this file.':return
send.1
if xm=3 print \"XT: Press [RETURN] to begin...";:get i$:print
if xm<>3 print \"XT: Sending "bs" blocks..."
use "a:x.dn",xm,f$
; update the record
send.2
on nocar goto terminate
if not(v) then byte=ram+29:byte(2)=byte(2)+1:byte=ram2
if v=13 then dl=dl+(peek(-25085)=255)
byte(16)=byte(16)+1:nb=l:push getslt:goto write
; send batch files
; ~~~~~~~~~~~~~~~~
batch
if not(b3) goto lsec
print "Send batch files..."
print '
XT: Please enter your file list now. A blank entry will exit the selection
mode.'\:y=1:flag=ram2+21:fill ram2+20,44,0:pt=2:bs=0
; get a file name or number
batch.1
print "Enter batch file #"right$("00"+str$(y),3);
input @2 ": " i$:if i$="" goto batch.2
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto batch.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) print chr$(8,24)"File doesn't exist"chr$(7):goto batch.1
; make sure file is there and validated
batch.x
if l<0 print chr$(8,24)"File doesn't exist"chr$(7):goto batch.1
if not(byte(7)) print chr$(8,24)"File must be validated"chr$(7):goto batch.1
if ty$="LST" print chr$(8,24)"Adding list files"chr$(7):goto lbatch
z=((byte(8)+byte(9)*256)-1)*4
print chr$(8,24);i$" ["right$("000"+str$(z),4)"]"
if flag(l+1)=0 then y=y+1:bs=bs+(byte(8)+byte(9)*256)-(byte(8)>0)
flag(l+1)=1:goto batch.1
; got all the files, print a prompt to let them cancel
batch.2
y=y-1:if y=0 then flag=ram+22:pt=1:return
x=bs/2:bs=bs*4:c=info(2)
if c=1 then b=x*34
if c=4 then b=x*9
if c=8 then b=x*4
print \"XT: Send "y;:input @0 " files [Y/N] ? " i$
if i$<>"Y" then flag=ram+22:pt=1:return
a=b/60:c=b mod 60:x=(clock(2)-clock(1))/60
print \"XT: Estimated time of transfer is "a" minutes, ";
print right$("0"+str$(c),2)" seconds":if clock(2)=0 goto batch.3
if x>a goto batch.3
print '
XT: 'chr$(7)'You do not have enough time left to download these files.'
flag=ram+22:pt=1:return
batch.3
poke ram2+20,y:link "a:xt.ymodem"
; we have a file macro, process it
lbatch
gosub name:f$=bf$+f$:open #2,f$
; fake an input to the user
lbatch.1
input #2,i$:if i$="" close:goto batch.1
if left$(i$,1)=";" goto lbatch.1
print "Enter batch file #"right$("00"+str$(y),3)": "i$
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) print chr$(8,24)"File doesn't exist"chr$(7):goto lbatch.1
; process what we have
if not(byte(7)) print chr$(8,24)"File must be validated"chr$(7):goto lbatch.1
z=((byte(8)+byte(9)*256)-1)*4
print chr$(8,24);i$" ["right$("000"+str$(z),4)"]"
if flag(l+1)=0 then y=y+1:bs=bs+(byte(8)+byte(9)*256)-(byte(8)>0)
flag(l+1)=1:goto lbatch.1
; view a file
; ~~~~~~~~~~~
view
if not(b3) goto lsec
input @2 "View: " i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:goto view.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
view.x
if not(l) goto nfile
if not(byte(7)) print '
XT: This file must first be validated
by the sysop before it can be
accessed...':return
gosub name:f$=bf$+f$:gosub dtype
if ty$<>"TXT" print \"XT: Not a TXT type file...":return
gosub chkfil:if a close:goto nfile
print \s$\:setint(1):copy #1:close
setint(""):return
; show file info
; ~~~~~~~~~~~~~~
; get filename & look for info
info
input @2 "Info on: " i$:if i$="" return:else na$=i$
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto info.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
; see if the file has information
info.x
if l<0 goto nfile:else c=byte(10)+byte(11)*256:d=byte(12)
if (not(d)) and (lb or (c=un)) goto info.a
if not(d) print "XT: "chr$(7)"File has no information":return
; display file information
info.1
input #msg(d),z:input #6,i$:gosub name:print \s$\
setint(1):print "Filename: ";:if lb print bf$;f$:else print i$
copy #6:setint(""):if lb or (c=un) goto info.a
return
; see if info is to be added or updated
info.a
if d print '
XT: Edit this information ? ';:else print '
XT: Would you like to enter a short
description of this upload ? ';
input @2 i$:i$=left$(i$,1):if i$<>"Y" return
edit(0):if d input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
gosub edesc:if not(edit(2)) return:else if d goto info.e
a=1
; find an empty message for this information
info.f
if msg(a) then a=a+1:else d=a:goto info.s
if a>msg(0) then d=a:goto info.s
goto info.f
; replace information
info.s
open #1,d1$:position #1,32,l+1:input #1,na$:close
kill #msg(d):print #msg(d),un:print #6,na$
print #6,"Uploader: "a1$" "a2$" [#"un"]"
print #6,"Uploaded: "date$" "time$\:copy #8,#6
; update the message file & rewrite directory entry
info.b
msg(d)=255:update:open #1,d1$:position #1,32,l+1
input #1,na$:input #1,ty$:read #1,ram2+7,10:byte(12)=d
position #1,32,l+1:print #1,na$:print #1,ty$
write #1,ram2+7,10:close:return
; info already exists
info.e
input #msg(d),a:input #6,x$\y$\z$:kill #msg(d)
print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6:goto info.b
; kill a file
; ~~~~~~~~~~~
; make sure the file belongs to the user
kill
input @2 "Kill: " i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto kill.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
kill.x
if l<0 goto nfile
if lb goto kill.1:else a=byte(10)+byte(11)*256
if a<>un print \"XT: That is not your file":return
; kill the file
kill.1
gosub name:i$="Y":if info(5) input @0 \"XT: Remove file from disk ? " i$
f$=bf$+f$:if i$="Y" kill f$
open #1,d1$:position #1,32,l+1:print #1,chr$(13):close
if not(v) then nibble(3)=nibble(3)-(a=un):else ul=ul-(a=un)
if not(byte(12)) goto getslt
; scan for the message containing file's information
kill.2
d=byte(12):msg(d)=0:kill #msg(d):update:goto getslt
; receive a file
; ~~~~~~~~~~~~~~
; get filename & check for conflicts
receive
if not(b4) goto lsec:else if nb=255 goto dfull
input @2 "Receive: " i$:if i$="" return
na$=left$(i$+chr$(32,14),15):i$=na$:gosub read
gosub name:f$=bf$+f$:gosub chkfil:close
if a and not(l) goto rec.2
d=0:if lb goto rec.1:else print '
XT: 'chr$(7)"Duplicate name on ProDOS volume":return
; see what sysop wishes to do with duplicate
rec.1
if l then nb=l
input @0 \"XT: File exists...overwrite ? " i$
if i$<>"Y" return:else kill f$:d=byte(12)
; if it's a DDD file, switch to standard XMODEM
rec.2
x$=left$(i$+chr$(32,14),15):x=xm:if x=4 goto rec.a
print \ "XT: Is this a compressed Dalton's Disk
input @2 " Disintegrator file [Y/N/Q] ? " i$
if i$="Q" return
if i$="Y" then dd=1:xm=0
; get the file
rec.a
create f$:print \"XT: Ready to receive..."
y=clock(2):a=clock(1):clock(2)=0:use "a:x.up",xm,f$:xm=x
c=clock(1):clock(2)=y+(c-a)
if not(v) then nibble(3)=nibble(3)+1:else ul=ul+(peek(-25085)=255)
if (v=13) and (peek(ed+3)<>255) print '
XT: The file you uploaded was received in
error and has been automatically
deleted...':kill f$:return
; compute some file info
gosub dtype:gosub size:gosub sfile:byte(12)=0
if dd=1 then dd=0:x=254:gosub type:ty$="DDD"
; ask for a description
on nocar goto rec.4
if d print '
XT: Do you want to change the existing
file information ? ';:else print '
XT: Would you like to enter a short
description of this upload ? ';
input @2 i$:i$=left$(i$,1):if i$<>"Y" goto rec.3
if d input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
edit(0):gosub edesc:if not(edit(2)) goto rec.3
if d then byte(12)=d:kill #msg(d):update:goto rec.i
a=1
rec.f
if msg(a) then a=a+1:else d=a:goto rec.i
if a>msg(0) then d=a:goto rec.i
goto rec.f
rec.i
kill #msg(d):print #msg(d),un:print #6,na$
print #6,"Uploader: "a1$" "a2$" [#"un"]"
print #6,"Uploaded: "date$" "time$\:copy #8,#6
msg(d)=255:update
rec.3
if d then byte(12)=d:d=0
if not(v) print '
XT: If there is a problem with this
upload, use the [K] command to
delete it...'
push getslt:if nb<>byte(4) goto write:else goto update
; loss of carrier - save file and then hang up
rec.4
if d then byte(12)=d:d=0
push term.1:if nb<>byte(4) goto write:else goto update
; copy a file
; ~~~~~~~~~~~
copy
if not(b4) goto lsec:else if nb=255 goto dfull
input @2 "Copy: " i$:if i$="" return
na$=left$(i$+chr$(32,14),15):i$=na$:gosub read
gosub name:f$=bf$+f$:gosub chkfil:close
if a and not(l) goto copy.2
if lb goto copy.1:else print '
XT: 'chr$(7)"Duplicate name on ProDOS volume":return
; see what sysop wishes to do with duplicate
copy.1
if l then nb=l
input @0 \"XT: File exists...overwrite ? " i$
if i$<>"Y" return:else kill f$
; get the text
copy.2
b=clock(2):a=clock(1):clock(2)=0
print \\screen$'
For files exceeding 4096 bytes, use the
R)eceive command...
Enter text: 'edit(3)' columns, [4K] max
[DONE] when finished, [.H] for help'
edit(0):edit(1):c=clock(1):clock(2)=b+(c-a):if not(edit(2)) return
input @0 \"XT: Is this a Ymodem list macro ? " i$
; get some info on the file
create f$:open #1,f$:copy #8,#1:close
nibble(3)=nibble(3)+1:gosub size:gosub sfile
byte(12)=0:byte(13)=0:ty$="TXT":if i$="Y" then ty$="LST"
push getslt:if nb<>byte(4) goto write:else goto update
; new file search
; ~~~~~~~~~~~~~~~
; scan for existing libraries
new
x=0:y=1:print \\screen$"XT: Display new files..."\\s$
open #1,"a1:xt.bitmap":read #1,ed+1,255:close
ob=bb:for z=1 to 255:setint(1):x=peek(ed+z)
if key(1) then z=255:next:goto new.2
if x>34 then next:goto new.2
if not(x) goto new.1:else if flag(x) goto new.1
next:goto new.2
; display # of new files in library
new.1
bb=z:gosub log:if y print '
XT: Scanning library #'right$("00"+str$(bb),3);
if not(y) print chr$(8,3);right$("00"+str$(bb),3);
if bf$="" gosub biterr:next:goto new.2
y=0:open #1,d1$:for l=1 to byte(4):position #1,32,l+1
input #1,f$:input #1,ty$:read #1,ram2+7,10
b$=when$:a$=right$(b$,3)+left$(b$,5):setint(1)
if f$="" next:close:setint(""):next:goto new.2
if (lc$<=a$) or (not(byte(7))) then y=y+1:else goto new.x
byte(17)=x:byte(18)=y:if y=1 print \:gosub dir.h
gosub dir.e:print:x=byte(17):y=byte(18)
new.x
if key(1) then l=byte(4):z=255
next:close:setint(""):next
; finished, or interrupted
new.2
setint("")
print \\"XT: Scan complete, press [RETURN]: ";:get i$
bb=ob:print:goto log
; search for a file
; ~~~~~~~~~~~~~~~~~
; get filename & starting library
search
x=0:input @2 "Find: " i$:if i$="" return
input @2 \"XT: Starting at library #" x$:if x$="" then x=1
if not(x) then x=val(x$):if (x<1) or (x>255) print '
XT: 'chr$(7)"That library doesn't exist":return
f$="a1:xv."+str$(x):gosub chkfil:close:if not(a) goto srch.1
print \"XT:"chr$(7)" Starting library doesn't exist...":return
; scan for existing libraries
srch.1
b=1:print \\screen$"XT: Searching for..."\" :>"i$\\s$
ob=bb:open #1,"a1:xt.bitmap":read #1,ed+1,255:close
for z=x to 255:setint(1):y=peek(ed+z)
if key(1) then z=255:next:goto srch.3
if y>34 then next:goto srch.3
if not(y) goto srch.2:else if flag(y) goto srch.2
next:goto srch.3
; found a valid volume, scan for entry
srch.2
bb=z:gosub log:if b print '
XT: Scanning library #'right$("00"+str$(bb),3);
if not(b) print chr$(8,3);right$("00"+str$(bb),3);
if bf$="" gosub biterr:next:goto srch.3
b=0:open #1,d1$:for l=1 to byte(4)
position #1,l+1,32:input #1,f$:setint(1)
if instr(i$,f$) then b=b+1:else goto srch.x
input #1,ty$:read #1,ram2+7,10
if b=1 print \:gosub dir.h
gosub dir.e:print
srch.x
if key(1) then l=byte(4):z=255
next:close:setint(""):next
; finished, or interrupted
srch.3
print \\"XT: Scan complete, press [RETURN]: ";:get i$
bb=ob:print:goto log
; log to a different library
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
; get new volume & see if it exsists
volume
print "Go to a different library..."\\"XT: Current library is #"bb
input @2 " Go to library [?]..." i$:if i$="" return
if i$="?" goto vol.2:else a=val(i$):if (a<1) or (a>255) print '
XT: 'chr$(7)"That library doesn't exist":return
; try to log to library
ob=bb:bb=a:gosub log:if bf$="" then l=bb:gosub biterr:goto vol.1
if not(b2) gosub lsec:bb=ob:goto log
print \"XT: Please hold...":gosub getslt:goto directory
; find out if this library is to be created
vol.1
if not(info(5)) print '
XT: 'chr$(7)"That library doesn't exist":bb=ob:goto log
tone(20,20):input @0 \"XT: Library doesn't exist...create ? " i$
if i$<>"Y" then bb=ob:goto log:else goto create
; scan bit map for available libraries
vol.2
print \\screen$"XT: You may access the following..."\\s$\
open #1,"a1:xt.bitmap":read #1,ed+1,255:close
open #1,"a1:xt.volumes":for l=1 to 255
setint(1):x=peek(ed+l):if key(1) then l=255:next:goto vol.4
if x>34 next:goto vol.4
if not(x) goto vol.3:else if flag(x) goto vol.3
next:goto vol.4
vol.3
position #1,32,l:input #1,x$
print "["right$("00"+str$(l),3)"]: "x$:next
; finished with list
vol.4
close:setint(""):print:clear key:goto volume
; hang up
; ~~~~~~~
; make sure
hangup
input @2 "Hang up ? " i$:if left$(i$,1)<>"Y" return
print \" :::::::::::::::::::::::::::::::::::::"
print ": EXfer v4.0 - (C)1987 M. Golaszewski :"
print " :::::::::::::::::::::::::::::::::::::"
; do it
terminate
poke ram2,v:when$=ram+20:if not(v) then byte=ram+29:goto term.1
byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
nibble(4)=ul/256:byte(4)=ul mod 256
term.1
clear:recall "a1:variables":kill "a1:variables":x=peek(ram2)
if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
link "a:main.seg","termin2"
; exit back to the board
; ~~~~~~~~~~~~~~~~~~~~~~
; make sure
exit
input @2 "Exit back to the BBS ? " i$:if left$(i$,1)<>"Y" return
print \" :::::::::::::::::::::::::::::::::::::"
print ": EXfer v4.0 - (C)1987 M. Golaszewski :"
print " :::::::::::::::::::::::::::::::::::::"
; recall variables & add uploads & downloads
exit.1
poke ram2,v:when$=ram+20:if not(v) then byte=ram+29:goto exit.2
byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
nibble(4)=ul/256:byte(4)=ul mod 256
exit.2
clear:recall "a1:variables":kill "a1:variables":x=peek(ram2)
if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
link "a:main.seg","fromsys"
; routines to edit or create libraries
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create
link "a:exfer.sys","create"
; :::::::::::::::::::
; library subroutines
; :::::::::::::::::::
; catalog a library
; ~~~~~~~~~~~~~~~~~
; print directory headers
directory
print \\screen$:gosub dir.h:use "a1:xtyp",bf$
; grab an entry
open #1,d1$:for l=1 to byte(4):f$=""
position #1,32,l+1:input #1,f$:input #1,ty$
position #1,32,l+1,20:read #1,ram2+7,10:if f$="" goto dir.1
setint(1)
; if its valid, print it
gosub dir.e:print:if byte(7) goto dir.1
if (not(byte(7))) and (not(lb)) goto dir.1
; update if not validated
print chr$(7,3);"** Validate above file [Y/N/K] ? ";:get i$
print chr$(8,35);chr$(32,35);chr$(8,35)
if i$="Y" position #1,32,l+1,20:print #1,chr$(255);
if i$<>"K" goto dir.1:else position #1,32,l+1:print #1,chr$(13)
i$=f$:gosub name:kill f$:if l<nb then nb=l
dir.1
if key(1) then l=byte(4)
next:close:setint("")
x=peek(865)+peek(866)*256:y=peek(867)+peek(868)*256
z=x-y:print \"Kbytes Free: "left$(str$(z)+chr$(32,3),4);
print " ";right$(" Kbytes Used: "+str$(y),17);
if edit(3)>39 print chr$(32,8)"Total Kbytes: "x:else print
return
; :::::::::::::::::::::
; directory subroutines
; :::::::::::::::::::::
; show a directory header
dir.h
print right$("00"+str$(bb),3)": "bn$;
if edit(3)>39 print " Librarian:";
print " "right$("00"+str$(b1),3)\
print " # Filename Typ I Size Uploaded";
if edit(3)>39 print " Uploader Downloaded Miscellaneous"\:else print\
return
; show a directory entry
dir.e
print right$("00"+str$(l+1),3)" "f$" "ty$" ";
if byte(12) print "Y ";:else print "N ";
x=byte(8)+byte(9)*256:print right$(" "+str$(x),4)" ";
b$=when$:if (not(byte(7))) print "VALIDATE";:else print b$;
a$=right$(b$,3)+left$(b$,5):y=byte(16):x=byte(10)+byte(11)*2 56
if edit(3)=39 print \" [U/L Usr "right$("00"+str$(x),3)"]";
if edit(3)>39 print " User "right$("00"+str$(x),3);
if edit(3)=39 print " [D/L "right$("00"+str$(y),3)" times]";
if edit(3)>39 print " "right$("00"+str$(y),3)" times";
if lc$<=a$ print " [NEW]";
return
; ::::::::::::::::::::
; disk I/O subroutines
; ::::::::::::::::::::
; log to a library and get some dir info
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log
byte=ram2:fill ram2,32,0:bf$="":z$="a1:xv."+str$(bb)
open #1,z$:input #1,bn$:input #1,bf$
read #1,ram2,7:close:b1=byte(5)+byte(6)*256
b2=1:if byte(0) then b2=flag(byte(0))
b3=1:if byte(1) then b3=flag(byte(1))
b4=1:if byte(2) then b4=flag(byte(2))
lb=(un=b1):if info(5) then lb=1:b2=1:b3=1:b4=1
d1$="a1:xv."+str$(bb):d2$="a1:dv."+str$(bb)
if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
return
; get an empty slot
; ~~~~~~~~~~~~~~~~~
getslt
nb=0:open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,i$
if (i$="") and (nb=0) then nb=l:l=byte(4)
next:close:if not(nb) then nb=byte(4)
return
; update "number of entries" counter
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update
byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
print #1,bf$:write #1,ram2,7:close
; write a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~~
write
open #1,d1$:position #1,32,nb+1:print #1,na$
print #1,ty$:write #1,ram2+7,10:close
z=nb:return
; read a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~
read
open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,f$
if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
next:close #1:l=0:return
read.1
input #1,ty$:read #1,ram2+7,10:close #1
return
; read a file by slot #
; ~~~~~~~~~~~~~~~~~~~~~
nread
if left$(i$,1)="#" then i$=mid$(i$,2)
l=val(i$):if (l<2) or (l>253) then l=0:return
open #1,d1$:position #1,32,l
input #1,f$:if f$="" close #1:l=0:return
input #1,ty$:read #1,ram2+7,10:close #1
i$=f$:if pt=2 return:else print \"XT: [#"l"]: "i$:return
; find the type of a file
; ~~~~~~~~~~~~~~~~~~~~~~~
dtype
use "a1:xtyp",f$:x=peek(ram2+32)
x$="???0TXT4PDA5BIN6ADB25AWP26ASP27SRC176OBJ177LIB178S16179RTL180EXE181"
x$=x$+"STR182RIF183NDA184CDA185SET186PNT192PIC193ANI194FNT200PAS239CMD240"
x$=x$+"COM245P16249BAS252VAR253REL254SYS255"
ty$="":y=instr(str$(x),x$):if y then ty$=mid$(x$,y-3,3):return
ty$="$"+chr$(48+x/16+((x/16)>9)*7)+chr$(48+x mod 16+((x mod 16)>9)*7)
return
; set the type of a file
; ~~~~~~~~~~~~~~~~~~~~~~
type
use "a1:xtyp",f$,x:return
; return the size of F$ in A
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
size
open #1,f$:a=size(1)/2+1:close:return
; see if file exists
; ~~~~~~~~~~~~~~~~~~
chkfil
open #1,f$:a=mark(1):return
; update errant bit-map
; ~~~~~~~~~~~~~~~~~~~~~
biterr
open #1,"a1:xt.bitmap":read #1,ed+1,255:close
poke ed+l,255:open #1,"a1:xt.bitmap"
write #1,ed+1,255:close:open #1,"a1:xt.volumes"
position #1,32,l:print #1,chr$(13):close
return
; :::::::::::::::::::
; special subroutines
; :::::::::::::::::::
; save user's stats before CLEAR
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
store
clear #8:byte=ram2:byte(0)=c:byte(1)=un mod 256
byte(2)=un/256:print #8,a1$,a2$,s$,lc$:return
; recall a user's stats after CLEAR
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
recall
c=byte(0):un=byte(1)+byte(2)*256
input #8,a1$,a2$,s$,lc$:return
; get a file description
; ~~~~~~~~~~~~~~~~~~~~~~
edesc
create "a:ul.log":open #1,"a:ul.log"
append #1
print #1,a1$" "a2$" uploaded "f$" to volume "bb
print #1,"at "date$" "time$\
close #1
print '
Enter description: 'edit(3)' cols, [4K] max
[DONE] when finished, [.H] for help'
edit(1):return
; convert to a valid ProDOS name
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; shorten I$ to directory length
name
if len(i$)>15 then i$=left$(i$,15)
i$=i$+chr$(1)
; make sure the first char is a letter
name.0
a=asc(left$(i$,1)):if a=1 pop:return
if (a>64) and (a<91) then i$=left$(i$,len(i$)-1):goto name.1
if (a>96) and (a<123) then i$=left$(i$,len(i$)-1):goto name.1
i$=mid$(i$,2):goto name.0
; remove symbols from the name
name.1
f$="":for x=1 to len(i$):a=asc(mid$(i$,x,1))
if (a>64) and (a<91) goto name.2
if (a>96) and (a<123) goto name.2
if (a>47) and (a<58) goto name.2
if a=46 goto name.2:else goto name.3
; add a valid character
name.2
f$=f$+chr$(a)
; if we dont have a name, return to the prompt
name.3
next:if f$="" pop:return
if len(f$)>15 then f$=left$(f$,15)
return
; set file information
; ~~~~~~~~~~~~~~~~~~~~
sfile
byte(7)=byte(3):byte(8)=a mod 256:byte(9)=a/256
byte(10)=un mod 256:byte(11)=un/256:byte(16)=0
when$="x":if lb then byte(7)=255
return
; ::::::::::::::
; error messages
; ::::::::::::::
lsec
print \"XT:"chr$(7)" Security too low...":return
dfull
print \"XT:"chr$(7)" Directory full...":return
nfile
print \"XT:"chr$(7)" No such file...":return